﻿using Basic.FormDAL;
using Basic.FormModel.PageControl;

namespace Basic.FormCollect.lmpl
{
    internal class PageControlCollect : IPageControlCollect
    {
        private readonly IPageControlDAL _BaseDAL;

        public PageControlCollect ( IPageControlDAL baseDAL )
        {
            this._BaseDAL = baseDAL;
        }

        public Dictionary<long, PageControlBase> Gets ( long[] ids )
        {
            return this._BaseDAL.Gets<PageControlBase>(ids).ToDictionary(a => a.Id, a => a);
        }
        public Result[] GetItems<Result> () where Result : class, new()
        {
            return this._BaseDAL.Gets<Result>(a => a.Status == FormRemoteModel.PageControlStatus.启用, "Sort");
        }
        public Result Get<Result> ( long id ) where Result : class, new()
        {
            return this._BaseDAL.Get<Result>(id);
        }
    }
}
